package poler.classes
{	
	import flash.utils.getQualifiedClassName;
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;

	/**
	 * 
	 * sets default implementation for a responder's fault handler.
	 */
	
	public class AbstractCommand
	{
		public var CustomErrorMessage:String = null;
		
		public function AbstractCommand() {
			if(flash.utils.getQualifiedClassName(this) == "classes::AbstractCommand"){
				throw new Error("ClassInstantiationException: Cannot create an instance of an abstract class.");
	         }
		}
	
		public function fault(info:Object):void
		{
			if(CustomErrorMessage != null){
				Alert.show(CustomErrorMessage, "Error!");
			}else{
				var faultEvt:FaultEvent = info as FaultEvent;
				Alert.show(faultEvt.fault.toString(), "Error!");
			}
			//
		}
	}
}
